package com.isunland.managesystem.ui;

import android.os.Bundle;
import android.support.annotation.Nullable;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import butterknife.BindView;
import butterknife.ButterKnife;
import com.isunland.managesystem.R;
import com.isunland.managesystem.base.BaseFragment;
import com.isunland.managesystem.entity.rCustomerNeedListMain;
import com.isunland.managesystem.utils.MyDateUtil;
import com.isunland.managesystem.utils.MyStringUtil;
import com.isunland.managesystem.widget.MultiLinesView;
import com.isunland.managesystem.widget.SingleLineView;

/**
 * 对象功能:
 * 开发公司: 北京信普达系统工程有限公司
 * 开发人员: wangyanan
 * 创建时间: 2017/7/11 16:41
 */
public class CustomerVisitHintDetailFragment extends BaseFragment {
  @BindView(R.id.slv_needProductDesc) SingleLineView slvNeedProductDesc;
  @BindView(R.id.slv_customerName) SingleLineView slvCustomerName;
  @BindView(R.id.mlv_nearCommDesc) MultiLinesView mlvNearCommDesc;
  @BindView(R.id.slv_fundEstimate) SingleLineView slvFundEstimate;
  @BindView(R.id.slv_nearContactDate) SingleLineView slvNearContactDate;
  @BindView(R.id.slv_nearContactName) SingleLineView slvNearContactName;
  @BindView(R.id.slv_customerInfoFromText) SingleLineView slvCustomerInfoFromText;
  @BindView(R.id.slv_salesName) SingleLineView slvSalesName;
  @BindView(R.id.slv_customerStatusText) SingleLineView slvCustomerStatusText;
  @BindView(R.id.slv_nearCustomerName) SingleLineView slvNearCustomerName;
  @BindView(R.id.slv_regStaffName) SingleLineView slvRegStaffName;
  @BindView(R.id.slv_regDate) SingleLineView slvRegDate;
  private rCustomerNeedListMain mItem;

  @Override public void initData() {
    super.initData();
    mItem =
        (!(mBaseParams.getItem() instanceof rCustomerNeedListMain)) ? new rCustomerNeedListMain()
            : (rCustomerNeedListMain) mBaseParams.getItem();
  }

  @Nullable @Override
  public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container,
      @Nullable Bundle savedInstanceState) {
    View view = inflater.inflate(R.layout.fragment_customer_visit_hint_detail, container, false);
    ButterKnife.bind(this, view);
    return view;
  }

  @Override public void initView(View view, Bundle savedInstanceState) {
    super.initView(view, savedInstanceState);
    setTitleCustom(MyStringUtil.connect(R.string.customerVisitHint, R.string.detail1));
    slvCustomerInfoFromText.setTextContent(mItem.getCustomerInfoFromText());
    slvCustomerName.setTextContent(mItem.getCustomerName());
    slvCustomerStatusText.setTextContent(mItem.getCustomerStatusText());
    slvFundEstimate.setTextContent(mItem.getFundEstimate());
    slvNearContactDate.setTextContent(
        MyDateUtil.format(mItem.getNearContactDate(), MyDateUtil.TYPE_DATE));
    slvNearContactName.setTextContent(mItem.getNearContactName());
    slvNearCustomerName.setTextContent(mItem.getNearCustomerName());
    slvNeedProductDesc.setTextContent(mItem.getNeedProductDesc());
    slvRegDate.setTextContent(MyDateUtil.format(mItem.getRegDate(), MyDateUtil.TYPE_DATE));
    slvRegStaffName.setTextContent(mItem.getRegStaffName());
    slvSalesName.setTextContent(mItem.getSalesName());
    mlvNearCommDesc.setTextContent(mItem.getNearCommDesc());
  }
}
